package com.app.business.utils;

import com.app.business.model.Contract;
import com.app.business.model.House;
import com.app.business.service.HouseService;
import com.app.system.utils.ApplicationContextProvider;
import org.springframework.context.ApplicationContext;

import java.math.BigDecimal;
import java.util.List;


/**
 * 规则后续手动处理排序
 * 如果未选保障房，则需要把保障区房源根据规则减少1
 * Created by ddz on 2022/5/30.
 */
public class SetHouseStyleUtils {
    private static HouseService houseService;

    public static void SetHouseStyle(Contract contract) {
        ApplicationContext applicationContext = ApplicationContextProvider.getApplicationContext();
        houseService = (HouseService) applicationContext.getBean(HouseService.class);
        List<House> chooseHouseList = houseService.getHouseListByContractId(contract.getId());
        if (chooseHouseList.size() > 0) {
            for (House house : chooseHouseList) {
                if (house.getHouseStyle() != null && house.getHouseStyle().equals("保障区房源")) {
                    return;
                }
            }
        }
        List<House> houseList = houseService.getHouseListByHouseMsg(contract.getZsProject().getId(), "0302");
        House house = houseList.get(0);
        System.out.println(house.getHouseNumStr());
    }
}